﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WaterRegimenMonitor.Common
{
    /// <summary>
    /// 辅助类。
    /// </summary>
    public static class Utility
    {
        /// <summary>
        /// 获得一个值，用于指示是否为调试模式。
        /// </summary>
        /// <value>
        /// 如果为调试模式，则返回<c>true</c>，否则返回<c>false</c>。
        /// </value>
        public static bool IsDebug
        {
            get
            {
#if DEBUG
                return true;
#else
                return false;
#endif
            }
        }

        /// <summary>
        /// 初始化类型<see cref="Utility"/>的新实例。
        /// </summary>
        static Utility()
        {
            //初始化内容类型字典
            ContentTypeDictionary = new Dictionary<string, string>
            {
                //图片类型
                {".bmp", "image/bmp"},
                {".gif", "image/gif"},
                {".jpeg", "image/jpeg"},
                {".jpg", "image/jpeg"},
                {".png", "image/png"},
                {".tif", "image/tiff"},
                {".tiff", "image/tiff"},
                //文档类型
                {".doc", "application/msword"},
                {".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
                {".pdf", "application/pdf"},
                //幻灯片类型
                {".ppt", "application/vnd.ms-powerpoint"},
                {".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
                //数据类型
                {".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
                {".xls", "application/vnd.ms-excel"},
                {".csv", "text/csv"},
                {".xml", "text/xml"},
                {".txt", "text/plain"},
                //压缩文件
                {".zip", "application/zip"},
                //音乐
                {".ogg", "application/ogg"},
                {".mp3", "audio/mpeg"},
                {".wma", "audio/x-ms-wma"},
                {".wav", "audio/x-wav"},
                //视频
                {".wmv", "audio/x-ms-wmv"},
                {".swf", "application/x-shockwave-flash"},
                {".avi", "video/avi"},
                {".mp4", "video/mp4"},
                {".mpeg", "video/mpeg"},
                {".mpg", "video/mpeg"},
                {".qt", "video/quicktime"}
            };
        }

        /// <summary>
        /// 内容类型字典。
        /// </summary>
        public static readonly Dictionary<string, string> ContentTypeDictionary;
    }
}
